package org.sy.lab.多线程基础._3_同步辅助类._4_Phaser阶段器;



public class Rocket {
	
	private MyPhaser phaser = new MyPhaser(4);
	
	public void first(String name) {
		System.out.println(name + "在阶段1就绪");
		phaser.arriveAndAwaitAdvance();
	}
	
	public void second(String name) {
		System.out.println("--" + name + "在阶段2就绪");
		phaser.arriveAndAwaitAdvance();
	}
	
	public void third(String name) {
		System.out.println("----" + name + "在阶段3就绪");
		phaser.arriveAndAwaitAdvance();
	}
	
	public void secondRemove(String name) {
		System.out.println("--" + name + "在阶段2就绪");
		phaser.arriveAndAwaitAdvance();
		
		System.out.println("--" + name + "在阶段2结束后移除");
		phaser.arriveAndDeregister();
	}
}
